const replace = (a = '',b = '',c = '') => {
  if(a === null || b === null || c === null) return a
  return a.split(b).join(c)
}


const a = undefined
const b = undefined
const c = undefined
console.log(replace( a, b, c))